Location:
Search - int 13
Search list
Description: 编制具有如下原型的函数prime,用来判断整数n是否为素数:bool prime(int n) 而后编制主函数,任意输入一个大于4的偶数d,找出满足d=d1+d2的所有数对,其中要求d1与d2均为素数(通过调用prime来判断素数)。如偶数18可以分解为11+7以及13+5;而偶数80可以分解为:43+37、61+19、67+13、73+7。
提示:i与d-i的和恰为偶数d,而且只有当i与d-i均为奇数时才有可能成为所求的“数对”。
-Prepared with the following function prototype prime, used to determine whether an integer n prime numbers: bool prime (int n) before the preparation of the main function, indiscriminate importation of a greater than 4, even d, to find out to satisfy d = d1+ D2 all the number of , which calls for d1 and d2 are prime numbers (by calling the prime to determine prime numbers). If even 18 can be decomposed into 11+ 7 and 13+ 5 and even 80 can be decomposed into: 43+ 37,612 B! 19,672 B! 13,732 B! 7. Tip: i with di and exactly even d, and only when i and di are odd when they may become the order of a few of.
Platform: |
Size: 904192 |
Author: |
Hits:
Description: 12. 编制具有如下原型的函数prime,用来判断整数n是否为素数:bool prime(int n) 而后编制主函数,任意输入一个大于4的偶数d,找出满足d=d1+d2的所有数对,其中要求d1与d2均为素数(通过调用prime来判断素数)。如偶数18可以分解为11+7以及13+5;而偶数80可以分解为:43+37、61+19、67+13、73+7。
提示:i与d-i的和恰为偶数d,而且只有当i与d-i均为奇数时才有可能成为所求的“数对”。
-12. The preparation of the prototype has the following functions prime, used to determine whether an integer n prime numbers: bool prime (int n) before the preparation of the main function, indiscriminate importation of a greater than 4 even d, to meet to find d = d1+ D2 all the number of , which calls for d1 and d2 are prime numbers (by calling the prime to determine prime numbers). If even 18 can be decomposed into 11+ 7 and 13+ 5 and even 80 can be decomposed into: 43+ 37,612 B! 19,672 B! 13,732 B! 7. Tip: i with di and exactly even-d, but only when i and di are odd when they may become the order of a few of.
Platform: |
Size: 1024 |
Author: shen |
Hits:
Description: c语言计算几何
三角化 Ch1, Code 1.14
凸形外壳[2D] Ch3, Code 3.8
凸形外壳[3D] Ch4, Code 4.8
球 Chapter 4, Fig. 4.15
德劳内类型 Ch5, Code 5.2
...See *English version.-\Computational Geometry in C\ the book s recipe
Triangulate Chapter 1, Code 1.14 /tri
Convex Hull[2D] Chapter 3, Code 3.8 /graham
Convex Hull[3D] Chapter 4, Code 4.8 /chull
sphere.c Chapter 4, Fig. 4.15 /sphere
Delaunay Triang Chapter 5, Code 5.2 /dt
SegSegInt Chapter 7, Code 7.2 /segseg
Point-in-poly Chapter 7, Code 7.13 /inpoly
Point-in-hedron Chapter 7, Code 7.15 /inhedron
Int Conv Poly Chapter 7, Code 7.17 /convconv
Mink Convolve Chapter 8, Code 8.5 /mink
Arm Move Chapter 8, Code 8.7 /arm
Platform: |
Size: 57344 |
Author: XJ |
Hits:
Description: create table userInfo --用户信息表
(
customerID int identity(1,1),--顾客编号
customerName varchar(8) not null,--姓名
pid varchar(18) not null,--身份证号
telephone varchar(13) not null,--电话
address varchar(50)--地址
)-create table userInfo --用户信息表
(
customerID int identity(1,1),--顾客编号
customerName varchar(8) not null,--姓名
pid varchar(18) not null,--身份证号
telephone varchar(13) not null,--电话
address varchar(50)--地址
)
Platform: |
Size: 3072 |
Author: 张三 |
Hits:
Description: Syntax of TINY+
An EBNF grammar for TINY+ is as follows (Strings in bold are terminals):
1. program -> declarations stmt-sequence
2. declarations -> decl declarations |²
3. decl -> type-specifi er varlist
4. type-specifi er -> int | bool | string
5. varlist -> identifi er { , identifi er }
6. stmt-sequence -> statement { statement }
7. statement -> if-stmt | repeat-stmt | assign-stmt | read-stmt | write-stmt
| while-stmt
8. while-stmt -> while bool-exp do stmt-sequence end
9. if-stmt -> if bool-exp then stmt-sequence [else stmt-sequence] end
10. repeat-stmt -> repeat stmt-sequence until bool-exp
11. assign-stmt -> identifi er := exp
12. read-stmt -> read identifi er
13. write-stmt -> write exp
14. exp -> arithmetic-exp | bool-exp | string-exp
15. arithmetic-exp -> term { addop term }
16. addop -> + | --Syntax of TINY+
An EBNF grammar for TINY+ is as follows (Strings in bold are terminals):
1. program-> declarations stmt-sequence
2. declarations-> decl declarations |²
3. decl-> type-specifi er varlist
4. type-specifi er-> int | bool | string
5. varlist-> identifi er { , identifi er }
6. stmt-sequence-> statement { statement }
7. statement-> if-stmt | repeat-stmt | assign-stmt | read-stmt | write-stmt
| while-stmt
8. while-stmt-> while bool-exp do stmt-sequence end
9. if-stmt-> if bool-exp then stmt-sequence [else stmt-sequence] end
10. repeat-stmt-> repeat stmt-sequence until bool-exp
11. assign-stmt-> identifi er := exp
12. read-stmt-> read identifi er
13. write-stmt-> write exp
14. exp-> arithmetic-exp | bool-exp | string-exp
15. arithmetic-exp-> term { addop term }
16. addop->+ |-
Platform: |
Size: 1269760 |
Author: gavinfeng |
Hits:
Description: 一个DES的加密解密算法完整实现 包括S盒等重要实现,另外此程序还实现了文件数据流的加密解密
DESAlgorithm.java
DesHelper.java
DESStream.java
// des算法初始置换表ip
public static final int[] IP = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44,
36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40,
32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27,
19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23,
15, 7 }
// des算法终结置换表ip-1
public static final int[] IP_1 = { 40, 8, 48, 16, 56, 24, 64, 32, 39, 7,
47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45,
13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11,
51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49,
17, 57, 25 } 等-A DES, encryption and decryption algorithms, including the full realization of S boxes and other important implementation, the program also implements other file data stream encryption and decryption
DESAlgorithm.java
DesHelper.java
DESStream.java
// des算法初始置换表ip
public static final int[] IP = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44,
36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40,
32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27,
19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23,
15, 7 }
// des算法终结置换表ip-1
public static final int[] IP_1 = { 40, 8, 48, 16, 56, 24, 64, 32, 39, 7,
47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45,
13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11,
51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49,
17, 57, 25 } and so on
Platform: |
Size: 11264 |
Author: 不死鸟 |
Hits:
Description: 采样率为sr,多选择II导联作为心电分析数据,该分析要用到的数据记录至少为1分钟的心电波形数据-void main() (E3BGX[
{
const int N=15420 //N=sr*time M./3@A
const int n=(int)sr*0.04,yanshi=(int)sr*0.2,back=(int)sr*0.04 //n=sr*0.04,yanshi=sr*0.2?,back=sr*0.04 PDl=!>u
const int M=N //负斜率找寻阵维数M=N-n "q"$bY9<3
const int R=200 UUFW=m`
int Q=(int)sr*1.2 T/- VpU #
const int RR1=1.2*sr,RR4=(int)sr*1.6 //RR1=1.2*sr,RR2=1.5*sr,RR3=0.5*sr,RR4=1.6*sr tU {1.&D
float data[N][13],time,I,II,III,avr,avl,avf,v1,v2,v3,v4,v5,v6 { ft(y.#C=
const int F=2 ^qH|x>Z
int i=0
Platform: |
Size: 1024 |
Author: 轩零 |
Hits:
Description: 由于int有符号型可表示的最大数为2^31-1,为2147483647。位数为10位。13!=6227020800,就已经超过了int型表示范围。本程序用数组的思想实现了大整数的阶乘。-To achieve a large integer factorial
Platform: |
Size: 210944 |
Author: serenha |
Hits:
Description:
int biodquip() 检查设备,函数返回一字节,该字节每一位表示一个信息,如下:
第15位 打印机号
第14位 打印机号
第13位 未使用
第12位 连接游戏I/O
第11位 RS232端口号
第 8位 未使用
第 7位 软磁盘号
第 6位 软磁盘号,
00为1号驱动器,01为2号驱动器,10为3号驱动器,11为4号驱动器
第 5位 初始化
第 4位 显示器模式
00为未使用,01为40x25BW彩色显示卡
10为80x25BW彩色显示卡,11为80x25BW单色显示卡
第 3位 母扦件
第 2位 随机存贮器容量,00为16K,01为32K,10为48K,11为64K
第 1位 浮点共用处理器
第 0位 从软磁盘引导-int biodquip () check the equipment, the function returns a byte, the bytes that each message is as follows:
              15-bit printer No.
              14-bit printer No.
              Article 13 does not use
              12th game to connect I/O
              No. 11 RS232 port
              Article 8 is not used
              Article No. 7 diskettes
              6th floppy disk number,
                            00 to 1 drive, 01 for the 2 drive, 10 to 3, drive, drive 11 to 4
              5-bit initialization
              No. 4 display mode
                       
Platform: |
Size: 5120 |
Author: wanglc |
Hits:
Description: SquareDigits的算法简单实现,SquareDigits是topcoder的一个问题-
Problem Statement
***Note: Please keep programs under 7000 characters in length. Thank you
Class Name: SquareDigits
Method Name: smallestResult
Parameters: int
Returns: int
Define the function S(x) as the sum of the squares of the digits of x.
For example: S(3)=3*3=9 and S(230)=2*2+3*3+0*0=13.
Define the set T(x) to be the set of unique numbers that are produced by
repeatedly applying S to x. That is: S(x), S(S(x)), S(S(S(x))), etc...
For example, repeatedly applying S to 37:
S(37)=3*3+7*7=58.
S(58)=5*5+8*8=89.
S(89)=145.
S(145)=42.
S(42)=20.
S(20)=4.
S(4)=16.
S(16)=37.
Note this sequence will repeat so we can stop calculating now and:
T(37)={58,89,145,42,20,4,16,37}.
However, note T(x) may not necessarily contain x.
Implement a class SquareDigits, which contains a method smallestResult. The
method takes an int, n, as a parameter and returns the smallest int, x, such
that T(x) contains n.
The method signatu
Platform: |
Size: 1024 |
Author: 姜水烈山 |
Hits:
Description: 哈希表:
HashTable H int s,a,n,w,i,q,t g=1
cout<<"输入元素个数n:\n"
cin>>n
InitList_H(H)
for(i=0 i<16 i++)
H.elem[i]=10000
for(i=0 i<n i++)
{cout<<"输入你要输入的n个数:\n"
cin>>s t=1
H.count++
if(H.elem[s 13]==10000)
H.elem[s 13]=s
else{
while(H.elem[(s 13+t) 16]!=10000)t++
H.elem[(s 13+t) 16]=s }
}
cout<<"输入你要查找数:\n"
cin>>w
a=SearchHash(H,w)
if(a){if(a==200)cout<<"查找成功! :"<<H.elem[0]<<endl else cout<<"查找成功! :"<<H.elem[a]<<endl }
else { q=InsertHash(H,w) cout<<q<<"已插入!\n" }
for(i=0 i<16 i++)
{cout<<H.elem[i]<<" " }//if((i+1) 11==0)cout<<endl }
cout<<endl
return 0
}-Hash table: HashTable H int s, a, n, w, i, q, t g = 1 cout < < " Enter the number of elements n: \ n" cin> > n InitList_H (H) for (i = 0 i < 16 i++) H.elem [i] = 10000 for (i = 0 i <n i++)
{cout<<"输入你要输入的n个数:\n"
cin> > S t = 1 H.count++ if (H.elem [s 13] == 10000) H.elem [s 13] = s else (while (H.elem [(s 13+ t ) 16]! = 10000) t++ H.elem [(s 13+ t) 16] = s )) cout < < " Enter the number you want to find: \ n" cin> > w a = SearchHash (H, w) if (a) (if (a == 200) cout < < " find success!:" < <H.elem[0]<<endl else cout<<"查找成功! :"<<H.elem[a]<<endl }
else { q=InsertHash(H,w) cout<<q<<"已插入!\n" }
for(i=0 i<16 i++)
{cout<<H.elem[i]<<" " }//if((i+1) 11==0)cout<<endl }
cout<<endl
return 0
}
Platform: |
Size: 1024 |
Author: 王巍 |
Hits:
Description: Dspic30F4013解析GPSNMEA-0183协议源码,函数包括unsigned int GPS_time[9] //UTC时间
unsigned int GPS_wd[12] //纬度
unsigned int GPS_jd[13] //经度
unsigned int GPS_warn //定位警告
unsigned int GPS_quality //定位质量
unsigned int GPS_status //定位状态
unsigned int GPS_alt[8] //海拔
unsigned int GPS_sv[3] //使用卫星
unsigned int GPS_speed[10] //速度
unsigned int GPS_date[9] //UTC日期-Dspic30F4013 analysis GPSNMEA-0183 protocol
including :unsigned int GPS_time[9] //UTC时间
unsigned int GPS_wd[12] //纬度
unsigned int GPS_jd[13] //经度
unsigned int GPS_warn //定位警告
unsigned int GPS_quality //定位质量
unsigned int GPS_status //定位状态
unsigned int GPS_alt[8] //海拔
unsigned int GPS_sv[3] //使用卫星
unsigned int GPS_speed[10] //速度
unsigned int GPS_date[9] //UTC日期
Platform: |
Size: 102400 |
Author: 马西沛 |
Hits:
Description: 网上很多是错的
Define the function S(x) as the sum of the squares of the digits of x.
For example: S(3)=3*3=9 and S(230)=2*2+3*3+0*0=13.
Define the set T(x) to be the set of unique numbers that are produced by
repeatedly applying S to x. That is: S(x), S(S(x)), S(S(S(x))), etc...
For example, repeatedly applying S to 37:
-Class Name: SquareDigits
Method Name: smallestResult
Parameters: int
Returns: int
Define the function S(x) as the sum of the squares of the digits of x.
For example: S(3)=3*3=9 and S(230)=2*2+3*3+0*0=13.
Define the set T(x) to be the set of unique numbers that are produced by
repeatedly applying S to x. That is: S(x), S(S(x)), S(S(S(x))), etc...
For example, repeatedly applying S to 37:
S(37)=3*3+7*7=58.
S(58)=5*5+8*8=89.
S(89)=145.
S(145)=42.
S(42)=20.
S(20)=4.
S(4)=16.
S(16)=37.
Note this sequence will repeat so we can stop calculating now and:
T(37)={58,89,145,42,20,4,16,37}.
However, note T(x) may not necessarily contain x.
Implement a class SquareDigits, which contains a method smallestResult. The
method takes an int, n, as a parameter and returns the smallest int, x, such
that T(x) contains n.
The method signature is (be sure your method is public):
int smallestResult(int n)
TopCoder will ensure n is non-negative and is between 0
Platform: |
Size: 1024 |
Author: trastain |
Hits:
Description: 利用线性表实现一个通讯录管理,通信录的数据格式如下:
struct DataType
{
int ID //编号
char name[10] //姓名
char ch //性别
char phone[13] //电话
char addr[31] //地址
}
要求:
? 实现通讯录的建立、增加、删除、修改、查询等功能
? 能够实现简单的菜单交互,即可以根据用户输入的命令,选择不同的操作。
? 能够保存每次更新的数据(选作)
? 能够进行通讯录分类,比如班级类、好友类、黑名单等等(选作)
? 编写测试main()函数测试线性表的正确性
-An address book using the linear table implementation management, and communication of data recorded in the following format: struct DataType {int ID // No char name [10] // name char ch // sex char phone [13] // Phone char addr [31] // address} requirements: ? achieve the establishment of contacts, add, delete, modify, query and other functions to achieve a simple menu ? interaction, which can be based on user input commands, select a different operation. ? be able to save each update of data (selected for) ? contacts can be classified, such as the class category, friends class, black, etc. (selected for) ? writing test main () function to test the accuracy of the linear form
Platform: |
Size: 2048 |
Author: 贾森 |
Hits:
Description:
设RQ分为RQ1和RQ2,RQ1采用轮转法,时间q=7.
RQ1>RQ2,RQ2采用短进程优先调度算法。
测试数据如下:RQ1: P1-P5, RQ2: P6-P10
进程 P1 P2 P3 P4 P5 P6 P7 P8 P9 P10
运行时间 16 11 14 13 15 21 18 10 7 14
已等待时间 6 5 4 3 2 1 2 3 4 5
实现描述:
typedef struct tag_pcb
{ char name[8]
int need //须运行的时间
int turn //周转时间
struct tag_pcb *next
} PCB
PCB * RQ1,*RQ2
int clock=0 //时钟
main ( )
{ 输入RQ1;
输入RQ2;(最好从文件读入)
while(RQ1!=NULL)
Platform: |
Size: 1024 |
Author: fairybroken |
Hits:
Description: 题一:给出一个函数,原型为 int compare(char* dest,char* src)
要求比较两个字符串(由dest与src字符指针标识)
1,如果两字符串所含字母完全相同,则返回0;
2,如果两字符串所含字母相同(不区分大小写;A与a也算字母相同) ,则返回1
3,否则返回3-Topic 1: given a function prototype is int compare (char* dest, char* src) asked to compare two strings (by the character pointer dest and src logo) 1, if the two letters contained exactly the same string is returned 0 2, if two strings contain the same letters (not case-sensitive A letter with a can be considered the same), then return to 13, 3 otherwise
Platform: |
Size: 1024 |
Author: shuming |
Hits:
Description: /*6.用if-else编程实现以下计算(通过键盘接收x的值,通过屏幕输出结果)*//*8、用while循环,求 1~100的和*//*9、用do-while循环,求1~100的和 *//*10、用for循环,求1~ 100的和*//*11、求斐波拉契数列:1、1、2、3、5、8、13、21、34…的前40项。每行输出4个数。*/
/*12、把316这个数表示为两个数的和。其中一个数是13的倍数,另一个数是11的倍数。*//*13、例:把100-200之间不能被3整除的数,十个数为一行输出(注意使用continue)。*//*14、求2-10000以内的完全数。完全数:一个数的因子(除开自身)和,等于其自身。例如:6=1+2+3,6是完全数。*/
- int a[100]={0}
int sum=0,k=0
for(int i=2 i<=10000 i++)
{
for(int l=0 l<100 l++)
a[l]=0
k=0
sum=0
for(int j=1 j<=i/2 j++)
{
if(!(i j))
a[k++]=j
}
for(int m=0 m<k m++)
{
sum+=a[m]
}
if(sum==i)
cout<<i<<endl
}
Platform: |
Size: 230400 |
Author: 李湘平 |
Hits:
Description: 设计一个程序,使之完成下列功能。
要求:(1)完成矩阵转换,输出转换前和转换后的矩阵。
(2)矩阵转换后,计算主对角线数之和,并输出。
1 2 3 4 13 9 5 1
5 6 7 8————》14 10 6 2
9 10 11 12 15 11 7 3
13 14 15 16 16 12 8 4
设计一个程序,将下列10个已知的常数按照从小到大的顺序进行排序,并打印排序的结果。
300,46,78,109,21,70,26,290,166,8,
输入5名学生的信息(学号、姓名、五门功课成绩),然后按平均成绩从高分到低分进行排序并输出。要求使用结构体完成,结构类型如下:
struct stu{
long no //学号
char name[9] //姓名
int score[5] //成绩
float ave //平均成绩
};
-couhuoba
Platform: |
Size: 12288 |
Author: 凌珏陌 |
Hits:
Description: arduino + 1602 +dht11 + sr04 + ds1307-#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7)
/*
1602
vss to gnd
vdd to 5v
RS TO PIN2
RW TO GND
E TO PIN3
D4 TO PIN4
D5 TO PIN5
D6 TO PIN6
D7 TO PIN7
A TO 5V
K TO GND
*/
#include "Wire.h"
#define DS1307_ADDRESS 0x68
byte zero = 0x00 //workaround for issue#527
/*
DS1307
SDA TO PIN A4
SCL TO PIN A5
VCC TO 5V
GND TO GND
*/
#include <dht11.h>
dht11 DHT11
#define DHT11PIN 8 //DHT11 PIN 3 连接UNO 3
#define TRIGPIN 9
#define ECHOPIN 10
long ping() {
digitalWrite(TRIGPIN, LOW)
delayMicroseconds(2)
digitalWrite(TRIGPIN, HIGH)
delayMicroseconds(10)
digitalWrite(TRIGPIN, LOW)
return pulseIn(ECHOPIN, HIGH)/58
}
void setup() {
Wire.begin()
Serial.begin(9600)
//setDateTime() //MUST CONFIGURE IN FUNCTION
lcd.begin(16, 2)
//lcd.setCursor(0,1)
//lcd.write("LIGHT: ")
pinMode(TRIGPIN, OUTPUT)
pinMode(ECHOPIN, INPUT)
pinMode(13, OUTPUT)
}
void loop() {
//int sensorValue
Platform: |
Size: 2048 |
Author: dicklaw |
Hits:
Description: 俄罗斯方块
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include <time.h>
#include <conio.h>
using namespace std
#define A1 0//A代表长条型,B为方块,C为L型,D为闪电型(实在无法描述那个形状)
#define A2 1
#define B 2
#define C11 3
#define C12 4
#define C13 5
#define C14 6
#define C21 7
#define C22 8
#define C23 9
#define C24 10
#define D11 11
#define D12 12
#define D21 13
#define D22 14
/*typedef struct COORD { // coord.
SHORT X // horizontal coordinate
SHORT Y // vertical coordinate
} COORD
*/
void SetPos(int i,int j)//设定光标位置
{
COORD pos={i,j}
HANDLE Out=GetStdHandle(STD_OUTPUT_HANDLE)
SetConsoleCursorPosition(Out, pos)
}-Tetris. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .# Include <iostream># Include <stdlib.h># Include <windows.h># Include <time.h># Include <conio.h> using namespace std # define A1 0// A representative of the long bar, B is a block, C is L-shaped, D is the Lightning (really can not describe the shape)# define A2 1# define B 2# define C11 3# define C12 4# define C13 5# define C14 6# define C21 7# define C22 8# define C23 9# define C24 10# define D11 11# define D12 12# define D21 13# define D22 14 /* typedef struct COORD {//coord SHORT X .// horizontal coordinate SHORT Y // vertical coordinate} COORD */void SetPos (int i, int j)// set the cursor position {COORD pos = {i, j} HANDLE Out = GetStdHandle (STD_OUTPUT_HANDLE) SetConsoleCursorPosition (Out, pos) }. . . .
Platform: |
Size: 275456 |
Author: 天河 |
Hits: